package com.one.square.core.lock;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author cwm
 * @Description 对象
 * @date 2021/10/29 下午12:40
 * @Version 1.0
 */
@AllArgsConstructor
public class OneSquareLock implements AutoCloseable{
    /**
     * 锁对象
     */
    @Getter
    private final Object lock;

    /**
     * 分布式锁实现
     * @throws Exception
     */
    private final DistributedLock locker;

    @Override
    public void close() throws Exception {
        locker.unlock(lock);
    }
}
